package com.zpark.it.controller;

import com.zpark.it.param.PageParam;
import com.zpark.it.pojo.Category;
import com.zpark.it.service.CategoryService;
import com.zpark.it.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: CategoryController
 * @Author Charles
 * @Package com.zpark.it.controller
 * @Date 2023/7/27 11:45
 */
@RestController
@RequestMapping("category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping ("list")
    public R pageList(PageParam pageParam){
        return categoryService.pageList(pageParam);
    }
    @PostMapping ("save")
    public R save(Category category){
        return categoryService.save(category);
    }

    @PostMapping ("remove")
    public R remove(Integer categoryId){
        return categoryService.remove(categoryId);
    }

    @PostMapping ("update")
    public R update(Category category){
        return categoryService.update(category);
    }
}
